package ynu.edu.Dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import ynu.edu.Entity.Carbon;
import ynu.edu.Entity.Temperature;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

public interface TemperatureDao extends JpaRepository<Temperature,Long> {
    Optional<Temperature> findFirstByOrderByCreateTimeDesc();
    @Query("SELECT t FROM Temperature t WHERE t.createTime >= :oneDayAgo")
    List<Temperature> findByCreateTimeAfter(@Param("oneDayAgo") LocalDateTime oneDayAgo);
}
